<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>杀死由 proc_open 打开的进程</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="function.proc-open.html">« proc_open</a></li>
      <li style="float: right;"><a href="function.shell-exec.html">shell_exec »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="ref.exec.html">程序执行函数</a></li>
    <li>杀死由 proc_open 打开的进程</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="function.proc-terminate" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">proc_terminate</h1>
  <p class="verinfo">(PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">proc_terminate</span> &mdash; <span class="dc-title">杀死由 proc_open 打开的进程</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.proc-terminate-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>proc_terminate</strong></span>(<span class="methodparam"><span class="type">resource</span> <code class="parameter">$process</code></span>, <span class="methodparam"><span class="type">int</span> <code class="parameter">$signal</code><span class="initializer"> = 15</span></span>): <span class="type">bool</span></div>

  <p class="para rdfs-comment">
   向 <code class="parameter">process</code>（由 <span class="function"><a href="function.proc-open.html" class="function">proc_open()</a></span>
   创建）发送信号通知其终止。<span class="function"><strong>proc_terminate()</strong></span> 
   调用之后将会立即返回，而不会等待进程终止。
  </p>
  <p class="para">
   <span class="function"><strong>proc_terminate()</strong></span> 允许终止进程并继续其他的任务。可以使用
   <span class="function"><a href="function.proc-get-status.html" class="function">proc_get_status()</a></span> 函数轮询进程（查看是否已经停止）。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.proc-terminate-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt>
<code class="parameter">process</code></dt>

     <dd>

      <p class="para">
       将要关闭的由 <span class="function"><a href="function.proc-open.html" class="function">proc_open()</a></span> 打开的 <span class="type">resource</span>。
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">signal</code></dt>

     <dd>

      <p class="para">
        可选参数，仅用于 <abbr title="Portable Operating System Interface">POSIX</abbr> 操作系统。可以使用
        <code class="literal">kill(2)</code> 系统调用指定要发送到进程的信号。默认值为
        <code class="literal">SIGTERM</code>。
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.proc-terminate-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   返回已运行进程的终止状态。
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.proc-terminate-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.proc-open.html" class="function" rel="rdfs-seeAlso">proc_open()</a> - 执行一个命令，并且打开用来输入/输出的文件指针。</span></li>
    <li class="member"><span class="function"><a href="function.proc-close.html" class="function" rel="rdfs-seeAlso">proc_close()</a> - 关闭由 proc_open 打开的进程并且返回进程退出码</span></li>
    <li class="member"><span class="function"><a href="function.proc-get-status.html" class="function" rel="rdfs-seeAlso">proc_get_status()</a> - 获取由 proc_open 函数打开的进程的信息</span></li>
   </ul>
  </p>
 </div>

</div></div></div></body></html>